﻿using System;
using Sys;
using System.Silverlight;
using seh=Sys.EventHandler;
using sea = Sys.EventArgs;
using System.Silverlight.Presentation;

namespace SBT
{
    public class MultiBehavior : AgBehavior
    {
        private ArrayList m_behaviors;
        public MultiBehavior()
        {
            
            m_behaviors = new ArrayList();
        }
        public void AddBehavior(AgBehavior behavior)
        {
            ArrayList.Add(m_behaviors, behavior);
            behavior.MultiBehavior = this;
        }
        public void RemoveBehavior(AgBehavior behavior)
        {
            ArrayList.Remove(m_behaviors, behavior);
            behavior.MultiBehavior = null;
        }
        public override void RaiseEvent(string name)
        {
            base.RaiseEvent(name);
            for (int i = 0; i < m_behaviors.Length; i++)
            {
                ((AgComponent)m_behaviors[i]).RaiseEvent(name);
            }
        }
    }
}